package org.point.common.util;

import java.io.IOException;

public class Base64 {
	
	/**
	 * 加密
	 * @param bstr
	 * @return
	 */
	public static String encode(byte[] bstr){    
		return new sun.misc.BASE64Encoder().encode(bstr);    
	}    
 	   
	/**  
	 * 解码  
	 * @param str  
	 * @return string  
	 */    
	public static byte[] decode(String str){    
		byte[] bt = null;    
		try {    
		    sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();    
		    bt = decoder.decodeBuffer( str );    
		} catch (IOException e) {    
		    e.printStackTrace();    
		}    
	    return bt;    
	}
}
